<?php

namespace App\Http\Requests\OperationManagement;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\BaseRequest;

class SanitationToiletRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'number' => 'required|integer',
            'address' => 'required',
            'area_id' => 'required|integer',
            'company' => 'required',
            'principal_id' => 'required|integer',
            'phone' => 'required|regex:/^1[345789][0-9]{9}$/',
            'man_squatting' => 'required|integer',
            'woman_squatting' => 'required|integer',
            'nursing_room' => 'required|integer',
            'commode' => 'required|integer',
            'facility' => 'required',
            'device_name' => 'required',
            'imei' => 'required|integer'
        ];
    }

    public function messages() 
    {
        return [
            'name.required' => '公厕名称不能为空',
            'number.required' => '编号不能为空',
            'number.integer' => '编号只能填写数字',
            'address.required' => '公厕地址不能为空',
            'area_id.required' => '所属区域不能为空',
            'area_id.integer' => '所属区域只能填写数字',
            'company.required' => '所属公司不能为空',
            'principal_id.required' => '负责人id不能为空',
            'principal_id.integer' => '负责人id只能填写数字',
            'phone.required' => '手机号不能为空',
            'phone.regex' => '手机号格式不合法',
            'man_squatting.required' => '男蹲位不能为空',
            'man_squatting.integer' => '男蹲位只能填写数字',
            'woman_squatting.required' => '女蹲位不能为空',
            'woman_squatting.integer' => '女蹲位只能填写数字',
            'nursing_room.required' => '护理室不能为空',
            'nursing_room.integer' => '护理室只能填写数字',
            'commode.required' => '洗脸台不能为空',
            'commode.integer' => '洗脸台只能填写数字',
            'facility.required' => '便民设施不能为空',
            'device_name.required' => '设备名称不能为空',
            'imei.required' => '设备唯一imei不能为空',
            'imei.integer' => '设备唯一imei只能填写数字'
        ];
    }
}
